/**
Copyright [2008] [Julian Gamble] 

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

	http://www.apache.org/licenses/LICENSE-2.0 
	
Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License. 
 **/
package aerith.swing;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;

import javax.swing.JFrame;

import org.jdesktop.swingx.JXImagePanel;

import aerith.components.AerithSplashScreen;

public class AerithSplashScreenTest {

	private JXImagePanel regularContentPanel;

	private AerithSplashScreen layeredMyGlassPane;

	private JFrame frame;

	private final int HEIGHT = 600, WIDTH = 600;

	public AerithSplashScreenTest() throws Exception {
		initializeInterface();
	}

	private void initializeInterface() throws Exception {
		layeredMyGlassPane = new AerithSplashScreen();/////////////////

		// 1. Create the enclosing frame
		frame = new JFrame("Reflection Demo");
		frame.setPreferredSize(new Dimension(WIDTH, HEIGHT));
		frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

		initContentPanel();

		frame.setGlassPane(layeredMyGlassPane);////////////////////
		layeredMyGlassPane.setVisible(true);//////////////////////

		// 7. Add it all to the frame
		frame.setContentPane(regularContentPanel);
		frame.pack();
		frame.setVisible(true);
		regularContentPanel.setVisible(false);
	}

	private void initContentPanel() {
		// 2. Create the background panel for the enclosing frame
		Toolkit tk = Toolkit.getDefaultToolkit();
		Image coverArt = tk.getImage(getClass().getResource(
				"/DesertLandscape.png")); 

		regularContentPanel = new JXImagePanel();
		regularContentPanel.setLayout(new GridLayout());
		regularContentPanel.setImage(coverArt);
	}

	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {
		new AerithSplashScreenTest();
	}
}
